﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PatsTracks
{
    [Serializable]
    public class RewardProgram
    {
        bool isPercentReward;
        int percentReward, toBuy, getFree;
        string desc;
        public RewardProgram(int ToBuy, int GetFree, string Desc)
        {
            isPercentReward = false;
            toBuy = ToBuy;
            getFree = GetFree;
            desc = Desc;
            percentReward = -1;
        }
        public RewardProgram(int PercentReward, string Desc)
        {
            isPercentReward = true;
            toBuy = -1;
            getFree = -1;
            desc = Desc;
            percentReward = PercentReward;
        }
        public bool isPercent() { return isPercentReward; }
        public int PercentOff() { return percentReward; }
        public int ToBuy() { return toBuy; }
        public int GetFree() { return getFree; }
        public string GetDesc() { return desc; }
        public override string ToString()
        {
            if (isPercentReward)
            {
                if (percentReward == 0) return "NO DISCOUNT";
                return percentReward.ToString() + "% Discount";
            }
            if (getFree == 0) return "NO DISCOUNT";
            return "Buy " + toBuy.ToString() + " Get " + getFree.ToString() + " FREE";
        }
    }
}
